import { ITravelStrategy } from "./Interface";

// 具体的策略

export class BusStrategy implements ITravelStrategy {
  calcFee(distance: number): number {
    return distance < 10 ? 4 : 6;
  }
}

export class TaxiStrategy implements ITravelStrategy {
  calcFee(distance: number): number {
    return distance < 3 ? 8 : 8 + (distance - 3) * 3;
  }
}

export class SubwayStrategy implements ITravelStrategy {
  calcFee(distance: number): number {
    return distance < 6 ? 3 : 4;
  }
}

export class SharedBicycleStrategy implements ITravelStrategy {
  calcFee(distance: number): number {
    return 2;
  }
}
